// Code generated by smithy-go-codegen DO NOT EDIT.

package customerprofiles

import (
	"context"
	"github.com/aws/aws-sdk-go-v2/service/customerprofiles/types"
	"github.com/aws/smithy-go/middleware"
	smithyhttp "github.com/aws/smithy-go/transport/http"
)

// Lists all of the template information for object types.
func (c *Client) ListProfileObjectTypeTemplates(ctx context.Context, params *ListProfileObjectTypeTemplatesInput, optFns ...func(*Options)) (*ListProfileObjectTypeTemplatesOutput, error) {
	if params == nil {
		params = &ListProfileObjectTypeTemplatesInput{}
	}

	result, metadata, err := c.invokeOperation(ctx, "ListProfileObjectTypeTemplates", params, optFns, c.addOperationListProfileObjectTypeTemplatesMiddlewares)
	if err != nil {
		return nil, err
	}

	out := result.(*ListProfileObjectTypeTemplatesOutput)
	out.ResultMetadata = metadata
	return out, nil
}

type ListProfileObjectTypeTemplatesInput struct {

	// The maximum number of objects returned per page.
	MaxResults *int32

	// The pagination token from the previous ListObjectTypeTemplates API call.
	NextToken *string

	noSmithyDocumentSerde
}

type ListProfileObjectTypeTemplatesOutput struct {

	// The list of ListProfileObjectType template instances.
	Items []types.ListProfileObjectTypeTemplateItem

	// The pagination token from the previous ListObjectTypeTemplates API call.
	NextToken *string

	// Metadata pertaining to the operation's result.
	ResultMetadata middleware.Metadata

	noSmithyDocumentSerde
}

func (c *Client) addOperationListProfileObjectTypeTemplatesMiddlewares(stack *middleware.Stack, options Options) (err error) {
	err = stack.Serialize.Add(&awsRestjson1_serializeOpListProfileObjectTypeTemplates{}, middleware.After)
	if err != nil {
		return err
	}
	err = stack.Deserialize.Add(&awsRestjson1_deserializeOpListProfileObjectTypeTemplates{}, middleware.After)
	if err != nil {
		return err
	}

	if err = addlegacyEndpointContextSetter(stack, options); err != nil {
		return err
	}
	if err = addComputeContentLength(stack); err != nil {
		return err
	}
	if err = addResolveEndpointMiddleware(stack, options); err != nil {
		return err
	}
	if err = addComputePayloadSHA256(stack); err != nil {
		return err
	}
	if err = addRecordResponseTiming(stack); err != nil {
		return err
	}
	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
		return err
	}
	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
		return err
	}
	if err = addCredentialSource(stack, options); err != nil {
		return err
	}
	if err = stack.Initialize.Add(newServiceMetadataMiddleware(options.Region, "ListProfileObjectTypeTemplates"), middleware.Before); err != nil {
		return err
	}
	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
		return err
	}
	if err = addResponseErrorMiddleware(stack); err != nil {
		return err
	}
	if err = addRequestResponseLogging(stack, options); err != nil {
		return err
	}
	if err = addDisableHTTPSMiddleware(stack, options); err != nil {
		return err
	}
	if err = addInterceptors(stack, options); err != nil {
		return err
	}
	return nil
}
