1// Code generated by smithy-go-codegen DO NOT EDIT. 2 3package connect 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/connect/types" 11 "github.com/aws/smithy-go/middleware" 12 smithyhttp "github.com/aws/smithy-go/transport/http" 13) 14 15// Initiates a contact flow to start a new task. 16func (c *Client) StartTaskContact(ctx context.Context, params *StartTaskContactInput, optFns ...func(*Options)) (*StartTaskContactOutput, error) { 17 if params == nil { 18 params = &StartTaskContactInput{} 19 } 20 21 result, metadata, err := c.invokeOperation(ctx, "StartTaskContact", params, optFns, addOperationStartTaskContactMiddlewares) 22 if err != nil { 23 return nil, err 24 } 25 26 out := result.(*StartTaskContactOutput) 27 out.ResultMetadata = metadata 28 return out, nil 29} 30 31type StartTaskContactInput struct { 32 33 // The identifier of the contact flow for initiating the tasks. To see the 34 // ContactFlowId in the Amazon Connect console user interface, on the navigation 35 // menu go to Routing, Contact Flows. Choose the contact flow. On the contact flow 36 // page, under the name of the contact flow, choose Show additional flow 37 // information. The ContactFlowId is the last part of the ARN, shown here in bold: 38 // arn:aws:connect:us-west-2:xxxxxxxxxxxx:instance/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/contact-flow/846ec553-a005-41c0-8341-xxxxxxxxxxxx 39 // 40 // This member is required. 41 ContactFlowId *string 42 43 // The identifier of the Amazon Connect instance. 44 // 45 // This member is required. 46 InstanceId *string 47 48 // The name of a task that is shown to an agent in the Contact Control Panel (CCP). 49 // 50 // This member is required. 51 Name *string 52 53 // A custom key-value pair using an attribute map. The attributes are standard 54 // Amazon Connect attributes, and can be accessed in contact flows just like any 55 // other contact attributes. There can be up to 32,768 UTF-8 bytes across all 56 // key-value pairs per contact. Attribute keys can include only alphanumeric, dash, 57 // and underscore characters. 58 Attributes map[string]string 59 60 // A unique, case-sensitive identifier that you provide to ensure the idempotency 61 // of the request. 62 ClientToken *string 63 64 // A description of the task that is shown to an agent in the Contact Control Panel 65 // (CCP). 66 Description *string 67 68 // The identifier of the previous chat, voice, or task contact. 69 PreviousContactId *string 70 71 // A formatted URL that is shown to an agent in the Contact Control Panel (CCP). 72 References map[string]types.Reference 73} 74 75type StartTaskContactOutput struct { 76 77 // The identifier of this contact within the Amazon Connect instance. 78 ContactId *string 79 80 // Metadata pertaining to the operation's result. 81 ResultMetadata middleware.Metadata 82} 83 84func addOperationStartTaskContactMiddlewares(stack *middleware.Stack, options Options) (err error) { 85 err = stack.Serialize.Add(&awsRestjson1_serializeOpStartTaskContact{}, middleware.After) 86 if err != nil { 87 return err 88 } 89 err = stack.Deserialize.Add(&awsRestjson1_deserializeOpStartTaskContact{}, middleware.After) 90 if err != nil { 91 return err 92 } 93 if err = addSetLoggerMiddleware(stack, options); err != nil { 94 return err 95 } 96 if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { 97 return err 98 } 99 if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { 100 return err 101 } 102 if err = addResolveEndpointMiddleware(stack, options); err != nil { 103 return err 104 } 105 if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { 106 return err 107 } 108 if err = addRetryMiddlewares(stack, options); err != nil { 109 return err 110 } 111 if err = addHTTPSignerV4Middleware(stack, options); err != nil { 112 return err 113 } 114 if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { 115 return err 116 } 117 if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { 118 return err 119 } 120 if err = addClientUserAgent(stack); err != nil { 121 return err 122 } 123 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { 124 return err 125 } 126 if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { 127 return err 128 } 129 if err = addIdempotencyToken_opStartTaskContactMiddleware(stack, options); err != nil { 130 return err 131 } 132 if err = addOpStartTaskContactValidationMiddleware(stack); err != nil { 133 return err 134 } 135 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opStartTaskContact(options.Region), middleware.Before); err != nil { 136 return err 137 } 138 if err = addRequestIDRetrieverMiddleware(stack); err != nil { 139 return err 140 } 141 if err = addResponseErrorMiddleware(stack); err != nil { 142 return err 143 } 144 if err = addRequestResponseLogging(stack, options); err != nil { 145 return err 146 } 147 return nil 148} 149 150type idempotencyToken_initializeOpStartTaskContact struct { 151 tokenProvider IdempotencyTokenProvider 152} 153 154func (*idempotencyToken_initializeOpStartTaskContact) ID() string { 155 return "OperationIdempotencyTokenAutoFill" 156} 157 158func (m *idempotencyToken_initializeOpStartTaskContact) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( 159 out middleware.InitializeOutput, metadata middleware.Metadata, err error, 160) { 161 if m.tokenProvider == nil { 162 return next.HandleInitialize(ctx, in) 163 } 164 165 input, ok := in.Parameters.(*StartTaskContactInput) 166 if !ok { 167 return out, metadata, fmt.Errorf("expected middleware input to be of type *StartTaskContactInput ") 168 } 169 170 if input.ClientToken == nil { 171 t, err := m.tokenProvider.GetIdempotencyToken() 172 if err != nil { 173 return out, metadata, err 174 } 175 input.ClientToken = &t 176 } 177 return next.HandleInitialize(ctx, in) 178} 179func addIdempotencyToken_opStartTaskContactMiddleware(stack *middleware.Stack, cfg Options) error { 180 return stack.Initialize.Add(&idempotencyToken_initializeOpStartTaskContact{tokenProvider: cfg.IdempotencyTokenProvider}, middleware.Before) 181} 182 183func newServiceMetadataMiddleware_opStartTaskContact(region string) *awsmiddleware.RegisterServiceMetadata { 184 return &awsmiddleware.RegisterServiceMetadata{ 185 Region: region, 186 ServiceID: ServiceID, 187 SigningName: "connect", 188 OperationName: "StartTaskContact", 189 } 190} 191