1// Code generated by smithy-go-codegen DO NOT EDIT. 2 3package transcribe 4 5import ( 6 "context" 7 "fmt" 8 awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" 9 "github.com/aws/aws-sdk-go-v2/aws/signer/v4" 10 "github.com/aws/aws-sdk-go-v2/service/transcribe/types" 11 "github.com/aws/smithy-go/middleware" 12 smithyhttp "github.com/aws/smithy-go/transport/http" 13) 14 15// Provides more information about the call analytics categories that you've 16// created. You can use the information in this list to find a specific category. 17// You can then use the operation to get more information about it. 18func (c *Client) ListCallAnalyticsCategories(ctx context.Context, params *ListCallAnalyticsCategoriesInput, optFns ...func(*Options)) (*ListCallAnalyticsCategoriesOutput, error) { 19 if params == nil { 20 params = &ListCallAnalyticsCategoriesInput{} 21 } 22 23 result, metadata, err := c.invokeOperation(ctx, "ListCallAnalyticsCategories", params, optFns, c.addOperationListCallAnalyticsCategoriesMiddlewares) 24 if err != nil { 25 return nil, err 26 } 27 28 out := result.(*ListCallAnalyticsCategoriesOutput) 29 out.ResultMetadata = metadata 30 return out, nil 31} 32 33type ListCallAnalyticsCategoriesInput struct { 34 35 // The maximum number of categories to return in each page of results. If there are 36 // fewer results than the value you specify, only the actual results are returned. 37 // If you do not specify a value, the default of 5 is used. 38 MaxResults *int32 39 40 // When included, NextTokenfetches the next set of categories if the result of the 41 // previous request was truncated. 42 NextToken *string 43 44 noSmithyDocumentSerde 45} 46 47type ListCallAnalyticsCategoriesOutput struct { 48 49 // A list of objects containing information about analytics categories. 50 Categories []types.CategoryProperties 51 52 // The operation returns a page of jobs at a time. The maximum size of the list is 53 // set by the MaxResults parameter. If there are more categories in the list than 54 // the page size, Amazon Transcribe returns the NextPage token. Include the token 55 // in the next request to the operation to return the next page of analytics 56 // categories. 57 NextToken *string 58 59 // Metadata pertaining to the operation's result. 60 ResultMetadata middleware.Metadata 61 62 noSmithyDocumentSerde 63} 64 65func (c *Client) addOperationListCallAnalyticsCategoriesMiddlewares(stack *middleware.Stack, options Options) (err error) { 66 err = stack.Serialize.Add(&awsAwsjson11_serializeOpListCallAnalyticsCategories{}, middleware.After) 67 if err != nil { 68 return err 69 } 70 err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpListCallAnalyticsCategories{}, middleware.After) 71 if err != nil { 72 return err 73 } 74 if err = addSetLoggerMiddleware(stack, options); err != nil { 75 return err 76 } 77 if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { 78 return err 79 } 80 if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { 81 return err 82 } 83 if err = addResolveEndpointMiddleware(stack, options); err != nil { 84 return err 85 } 86 if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { 87 return err 88 } 89 if err = addRetryMiddlewares(stack, options); err != nil { 90 return err 91 } 92 if err = addHTTPSignerV4Middleware(stack, options); err != nil { 93 return err 94 } 95 if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { 96 return err 97 } 98 if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { 99 return err 100 } 101 if err = addClientUserAgent(stack); err != nil { 102 return err 103 } 104 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { 105 return err 106 } 107 if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { 108 return err 109 } 110 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListCallAnalyticsCategories(options.Region), middleware.Before); err != nil { 111 return err 112 } 113 if err = addRequestIDRetrieverMiddleware(stack); err != nil { 114 return err 115 } 116 if err = addResponseErrorMiddleware(stack); err != nil { 117 return err 118 } 119 if err = addRequestResponseLogging(stack, options); err != nil { 120 return err 121 } 122 return nil 123} 124 125// ListCallAnalyticsCategoriesAPIClient is a client that implements the 126// ListCallAnalyticsCategories operation. 127type ListCallAnalyticsCategoriesAPIClient interface { 128 ListCallAnalyticsCategories(context.Context, *ListCallAnalyticsCategoriesInput, ...func(*Options)) (*ListCallAnalyticsCategoriesOutput, error) 129} 130 131var _ ListCallAnalyticsCategoriesAPIClient = (*Client)(nil) 132 133// ListCallAnalyticsCategoriesPaginatorOptions is the paginator options for 134// ListCallAnalyticsCategories 135type ListCallAnalyticsCategoriesPaginatorOptions struct { 136 // The maximum number of categories to return in each page of results. If there are 137 // fewer results than the value you specify, only the actual results are returned. 138 // If you do not specify a value, the default of 5 is used. 139 Limit int32 140 141 // Set to true if pagination should stop if the service returns a pagination token 142 // that matches the most recent token provided to the service. 143 StopOnDuplicateToken bool 144} 145 146// ListCallAnalyticsCategoriesPaginator is a paginator for 147// ListCallAnalyticsCategories 148type ListCallAnalyticsCategoriesPaginator struct { 149 options ListCallAnalyticsCategoriesPaginatorOptions 150 client ListCallAnalyticsCategoriesAPIClient 151 params *ListCallAnalyticsCategoriesInput 152 nextToken *string 153 firstPage bool 154} 155 156// NewListCallAnalyticsCategoriesPaginator returns a new 157// ListCallAnalyticsCategoriesPaginator 158func NewListCallAnalyticsCategoriesPaginator(client ListCallAnalyticsCategoriesAPIClient, params *ListCallAnalyticsCategoriesInput, optFns ...func(*ListCallAnalyticsCategoriesPaginatorOptions)) *ListCallAnalyticsCategoriesPaginator { 159 if params == nil { 160 params = &ListCallAnalyticsCategoriesInput{} 161 } 162 163 options := ListCallAnalyticsCategoriesPaginatorOptions{} 164 if params.MaxResults != nil { 165 options.Limit = *params.MaxResults 166 } 167 168 for _, fn := range optFns { 169 fn(&options) 170 } 171 172 return &ListCallAnalyticsCategoriesPaginator{ 173 options: options, 174 client: client, 175 params: params, 176 firstPage: true, 177 } 178} 179 180// HasMorePages returns a boolean indicating whether more pages are available 181func (p *ListCallAnalyticsCategoriesPaginator) HasMorePages() bool { 182 return p.firstPage || p.nextToken != nil 183} 184 185// NextPage retrieves the next ListCallAnalyticsCategories page. 186func (p *ListCallAnalyticsCategoriesPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListCallAnalyticsCategoriesOutput, error) { 187 if !p.HasMorePages() { 188 return nil, fmt.Errorf("no more pages available") 189 } 190 191 params := *p.params 192 params.NextToken = p.nextToken 193 194 var limit *int32 195 if p.options.Limit > 0 { 196 limit = &p.options.Limit 197 } 198 params.MaxResults = limit 199 200 result, err := p.client.ListCallAnalyticsCategories(ctx, ¶ms, optFns...) 201 if err != nil { 202 return nil, err 203 } 204 p.firstPage = false 205 206 prevToken := p.nextToken 207 p.nextToken = result.NextToken 208 209 if p.options.StopOnDuplicateToken && prevToken != nil && p.nextToken != nil && *prevToken == *p.nextToken { 210 p.nextToken = nil 211 } 212 213 return result, nil 214} 215 216func newServiceMetadataMiddleware_opListCallAnalyticsCategories(region string) *awsmiddleware.RegisterServiceMetadata { 217 return &awsmiddleware.RegisterServiceMetadata{ 218 Region: region, 219 ServiceID: ServiceID, 220 SigningName: "transcribe", 221 OperationName: "ListCallAnalyticsCategories", 222 } 223} 224