github.com/twilio/twilio-go@v1.20.1/rest/flex/v1/flex_flows.go (about) 1 /* 2 * This code was generated by 3 * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ 4 * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ 5 * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ 6 * 7 * Twilio - Flex 8 * This is the public Twilio REST API. 9 * 10 * NOTE: This class is auto generated by OpenAPI Generator. 11 * https://openapi-generator.tech 12 * Do not edit the class manually. 13 */ 14 15 package openapi 16 17 import ( 18 "encoding/json" 19 "fmt" 20 "net/url" 21 "strings" 22 23 "github.com/twilio/twilio-go/client" 24 ) 25 26 // Optional parameters for the method 'CreateFlexFlow' 27 type CreateFlexFlowParams struct { 28 // A descriptive string that you create to describe the Flex Flow resource. 29 FriendlyName *string `json:"FriendlyName,omitempty"` 30 // The SID of the chat service. 31 ChatServiceSid *string `json:"ChatServiceSid,omitempty"` 32 // 33 ChannelType *string `json:"ChannelType,omitempty"` 34 // The channel contact's Identity. 35 ContactIdentity *string `json:"ContactIdentity,omitempty"` 36 // Whether the new Flex Flow is enabled. 37 Enabled *bool `json:"Enabled,omitempty"` 38 // 39 IntegrationType *string `json:"IntegrationType,omitempty"` 40 // The SID of the Studio Flow. Required when `integrationType` is `studio`. 41 IntegrationFlowSid *string `json:"Integration.FlowSid,omitempty"` 42 // The URL of the external webhook. Required when `integrationType` is `external`. 43 IntegrationUrl *string `json:"Integration.Url,omitempty"` 44 // The Workspace SID for a new Task. Required when `integrationType` is `task`. 45 IntegrationWorkspaceSid *string `json:"Integration.WorkspaceSid,omitempty"` 46 // The Workflow SID for a new Task. Required when `integrationType` is `task`. 47 IntegrationWorkflowSid *string `json:"Integration.WorkflowSid,omitempty"` 48 // The Task Channel SID (TCXXXX) or unique name (e.g., `sms`) to use for the Task that will be created. Applicable and required when `integrationType` is `task`. The default value is `default`. 49 IntegrationChannel *string `json:"Integration.Channel,omitempty"` 50 // The Task timeout in seconds for a new Task. Default is 86,400 seconds (24 hours). Optional when `integrationType` is `task`, not applicable otherwise. 51 IntegrationTimeout *int `json:"Integration.Timeout,omitempty"` 52 // The Task priority of a new Task. The default priority is 0. Optional when `integrationType` is `task`, not applicable otherwise. 53 IntegrationPriority *int `json:"Integration.Priority,omitempty"` 54 // In the context of outbound messaging, defines whether to create a Task immediately (and therefore reserve the conversation to current agent), or delay Task creation until the customer sends the first response. Set to false to create immediately, true to delay Task creation. This setting is only applicable for outbound messaging. 55 IntegrationCreationOnMessage *bool `json:"Integration.CreationOnMessage,omitempty"` 56 // When enabled, Flex will keep the chat channel active so that it may be used for subsequent interactions with a contact identity. Defaults to `false`. 57 LongLived *bool `json:"LongLived,omitempty"` 58 // When enabled, the Messaging Channel Janitor will remove active Proxy sessions if the associated Task is deleted outside of the Flex UI. Defaults to `false`. 59 JanitorEnabled *bool `json:"JanitorEnabled,omitempty"` 60 // The number of times to retry the Studio Flow or webhook in case of failure. Takes integer values from 0 to 3 with the default being 3. Optional when `integrationType` is `studio` or `external`, not applicable otherwise. 61 IntegrationRetryCount *int `json:"Integration.RetryCount,omitempty"` 62 } 63 64 func (params *CreateFlexFlowParams) SetFriendlyName(FriendlyName string) *CreateFlexFlowParams { 65 params.FriendlyName = &FriendlyName 66 return params 67 } 68 func (params *CreateFlexFlowParams) SetChatServiceSid(ChatServiceSid string) *CreateFlexFlowParams { 69 params.ChatServiceSid = &ChatServiceSid 70 return params 71 } 72 func (params *CreateFlexFlowParams) SetChannelType(ChannelType string) *CreateFlexFlowParams { 73 params.ChannelType = &ChannelType 74 return params 75 } 76 func (params *CreateFlexFlowParams) SetContactIdentity(ContactIdentity string) *CreateFlexFlowParams { 77 params.ContactIdentity = &ContactIdentity 78 return params 79 } 80 func (params *CreateFlexFlowParams) SetEnabled(Enabled bool) *CreateFlexFlowParams { 81 params.Enabled = &Enabled 82 return params 83 } 84 func (params *CreateFlexFlowParams) SetIntegrationType(IntegrationType string) *CreateFlexFlowParams { 85 params.IntegrationType = &IntegrationType 86 return params 87 } 88 func (params *CreateFlexFlowParams) SetIntegrationFlowSid(IntegrationFlowSid string) *CreateFlexFlowParams { 89 params.IntegrationFlowSid = &IntegrationFlowSid 90 return params 91 } 92 func (params *CreateFlexFlowParams) SetIntegrationUrl(IntegrationUrl string) *CreateFlexFlowParams { 93 params.IntegrationUrl = &IntegrationUrl 94 return params 95 } 96 func (params *CreateFlexFlowParams) SetIntegrationWorkspaceSid(IntegrationWorkspaceSid string) *CreateFlexFlowParams { 97 params.IntegrationWorkspaceSid = &IntegrationWorkspaceSid 98 return params 99 } 100 func (params *CreateFlexFlowParams) SetIntegrationWorkflowSid(IntegrationWorkflowSid string) *CreateFlexFlowParams { 101 params.IntegrationWorkflowSid = &IntegrationWorkflowSid 102 return params 103 } 104 func (params *CreateFlexFlowParams) SetIntegrationChannel(IntegrationChannel string) *CreateFlexFlowParams { 105 params.IntegrationChannel = &IntegrationChannel 106 return params 107 } 108 func (params *CreateFlexFlowParams) SetIntegrationTimeout(IntegrationTimeout int) *CreateFlexFlowParams { 109 params.IntegrationTimeout = &IntegrationTimeout 110 return params 111 } 112 func (params *CreateFlexFlowParams) SetIntegrationPriority(IntegrationPriority int) *CreateFlexFlowParams { 113 params.IntegrationPriority = &IntegrationPriority 114 return params 115 } 116 func (params *CreateFlexFlowParams) SetIntegrationCreationOnMessage(IntegrationCreationOnMessage bool) *CreateFlexFlowParams { 117 params.IntegrationCreationOnMessage = &IntegrationCreationOnMessage 118 return params 119 } 120 func (params *CreateFlexFlowParams) SetLongLived(LongLived bool) *CreateFlexFlowParams { 121 params.LongLived = &LongLived 122 return params 123 } 124 func (params *CreateFlexFlowParams) SetJanitorEnabled(JanitorEnabled bool) *CreateFlexFlowParams { 125 params.JanitorEnabled = &JanitorEnabled 126 return params 127 } 128 func (params *CreateFlexFlowParams) SetIntegrationRetryCount(IntegrationRetryCount int) *CreateFlexFlowParams { 129 params.IntegrationRetryCount = &IntegrationRetryCount 130 return params 131 } 132 133 // 134 func (c *ApiService) CreateFlexFlow(params *CreateFlexFlowParams) (*FlexV1FlexFlow, error) { 135 path := "/v1/FlexFlows" 136 137 data := url.Values{} 138 headers := make(map[string]interface{}) 139 140 if params != nil && params.FriendlyName != nil { 141 data.Set("FriendlyName", *params.FriendlyName) 142 } 143 if params != nil && params.ChatServiceSid != nil { 144 data.Set("ChatServiceSid", *params.ChatServiceSid) 145 } 146 if params != nil && params.ChannelType != nil { 147 data.Set("ChannelType", *params.ChannelType) 148 } 149 if params != nil && params.ContactIdentity != nil { 150 data.Set("ContactIdentity", *params.ContactIdentity) 151 } 152 if params != nil && params.Enabled != nil { 153 data.Set("Enabled", fmt.Sprint(*params.Enabled)) 154 } 155 if params != nil && params.IntegrationType != nil { 156 data.Set("IntegrationType", *params.IntegrationType) 157 } 158 if params != nil && params.IntegrationFlowSid != nil { 159 data.Set("Integration.FlowSid", *params.IntegrationFlowSid) 160 } 161 if params != nil && params.IntegrationUrl != nil { 162 data.Set("Integration.Url", *params.IntegrationUrl) 163 } 164 if params != nil && params.IntegrationWorkspaceSid != nil { 165 data.Set("Integration.WorkspaceSid", *params.IntegrationWorkspaceSid) 166 } 167 if params != nil && params.IntegrationWorkflowSid != nil { 168 data.Set("Integration.WorkflowSid", *params.IntegrationWorkflowSid) 169 } 170 if params != nil && params.IntegrationChannel != nil { 171 data.Set("Integration.Channel", *params.IntegrationChannel) 172 } 173 if params != nil && params.IntegrationTimeout != nil { 174 data.Set("Integration.Timeout", fmt.Sprint(*params.IntegrationTimeout)) 175 } 176 if params != nil && params.IntegrationPriority != nil { 177 data.Set("Integration.Priority", fmt.Sprint(*params.IntegrationPriority)) 178 } 179 if params != nil && params.IntegrationCreationOnMessage != nil { 180 data.Set("Integration.CreationOnMessage", fmt.Sprint(*params.IntegrationCreationOnMessage)) 181 } 182 if params != nil && params.LongLived != nil { 183 data.Set("LongLived", fmt.Sprint(*params.LongLived)) 184 } 185 if params != nil && params.JanitorEnabled != nil { 186 data.Set("JanitorEnabled", fmt.Sprint(*params.JanitorEnabled)) 187 } 188 if params != nil && params.IntegrationRetryCount != nil { 189 data.Set("Integration.RetryCount", fmt.Sprint(*params.IntegrationRetryCount)) 190 } 191 192 resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) 193 if err != nil { 194 return nil, err 195 } 196 197 defer resp.Body.Close() 198 199 ps := &FlexV1FlexFlow{} 200 if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { 201 return nil, err 202 } 203 204 return ps, err 205 } 206 207 // 208 func (c *ApiService) DeleteFlexFlow(Sid string) error { 209 path := "/v1/FlexFlows/{Sid}" 210 path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) 211 212 data := url.Values{} 213 headers := make(map[string]interface{}) 214 215 resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) 216 if err != nil { 217 return err 218 } 219 220 defer resp.Body.Close() 221 222 return nil 223 } 224 225 // 226 func (c *ApiService) FetchFlexFlow(Sid string) (*FlexV1FlexFlow, error) { 227 path := "/v1/FlexFlows/{Sid}" 228 path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) 229 230 data := url.Values{} 231 headers := make(map[string]interface{}) 232 233 resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) 234 if err != nil { 235 return nil, err 236 } 237 238 defer resp.Body.Close() 239 240 ps := &FlexV1FlexFlow{} 241 if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { 242 return nil, err 243 } 244 245 return ps, err 246 } 247 248 // Optional parameters for the method 'ListFlexFlow' 249 type ListFlexFlowParams struct { 250 // The `friendly_name` of the Flex Flow resources to read. 251 FriendlyName *string `json:"FriendlyName,omitempty"` 252 // How many resources to return in each list page. The default is 50, and the maximum is 1000. 253 PageSize *int `json:"PageSize,omitempty"` 254 // Max number of records to return. 255 Limit *int `json:"limit,omitempty"` 256 } 257 258 func (params *ListFlexFlowParams) SetFriendlyName(FriendlyName string) *ListFlexFlowParams { 259 params.FriendlyName = &FriendlyName 260 return params 261 } 262 func (params *ListFlexFlowParams) SetPageSize(PageSize int) *ListFlexFlowParams { 263 params.PageSize = &PageSize 264 return params 265 } 266 func (params *ListFlexFlowParams) SetLimit(Limit int) *ListFlexFlowParams { 267 params.Limit = &Limit 268 return params 269 } 270 271 // Retrieve a single page of FlexFlow records from the API. Request is executed immediately. 272 func (c *ApiService) PageFlexFlow(params *ListFlexFlowParams, pageToken, pageNumber string) (*ListFlexFlowResponse, error) { 273 path := "/v1/FlexFlows" 274 275 data := url.Values{} 276 headers := make(map[string]interface{}) 277 278 if params != nil && params.FriendlyName != nil { 279 data.Set("FriendlyName", *params.FriendlyName) 280 } 281 if params != nil && params.PageSize != nil { 282 data.Set("PageSize", fmt.Sprint(*params.PageSize)) 283 } 284 285 if pageToken != "" { 286 data.Set("PageToken", pageToken) 287 } 288 if pageNumber != "" { 289 data.Set("Page", pageNumber) 290 } 291 292 resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) 293 if err != nil { 294 return nil, err 295 } 296 297 defer resp.Body.Close() 298 299 ps := &ListFlexFlowResponse{} 300 if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { 301 return nil, err 302 } 303 304 return ps, err 305 } 306 307 // Lists FlexFlow records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. 308 func (c *ApiService) ListFlexFlow(params *ListFlexFlowParams) ([]FlexV1FlexFlow, error) { 309 response, errors := c.StreamFlexFlow(params) 310 311 records := make([]FlexV1FlexFlow, 0) 312 for record := range response { 313 records = append(records, record) 314 } 315 316 if err := <-errors; err != nil { 317 return nil, err 318 } 319 320 return records, nil 321 } 322 323 // Streams FlexFlow records from the API as a channel stream. This operation lazily loads records as efficiently as possible until the limit is reached. 324 func (c *ApiService) StreamFlexFlow(params *ListFlexFlowParams) (chan FlexV1FlexFlow, chan error) { 325 if params == nil { 326 params = &ListFlexFlowParams{} 327 } 328 params.SetPageSize(client.ReadLimits(params.PageSize, params.Limit)) 329 330 recordChannel := make(chan FlexV1FlexFlow, 1) 331 errorChannel := make(chan error, 1) 332 333 response, err := c.PageFlexFlow(params, "", "") 334 if err != nil { 335 errorChannel <- err 336 close(recordChannel) 337 close(errorChannel) 338 } else { 339 go c.streamFlexFlow(response, params, recordChannel, errorChannel) 340 } 341 342 return recordChannel, errorChannel 343 } 344 345 func (c *ApiService) streamFlexFlow(response *ListFlexFlowResponse, params *ListFlexFlowParams, recordChannel chan FlexV1FlexFlow, errorChannel chan error) { 346 curRecord := 1 347 348 for response != nil { 349 responseRecords := response.FlexFlows 350 for item := range responseRecords { 351 recordChannel <- responseRecords[item] 352 curRecord += 1 353 if params.Limit != nil && *params.Limit < curRecord { 354 close(recordChannel) 355 close(errorChannel) 356 return 357 } 358 } 359 360 record, err := client.GetNext(c.baseURL, response, c.getNextListFlexFlowResponse) 361 if err != nil { 362 errorChannel <- err 363 break 364 } else if record == nil { 365 break 366 } 367 368 response = record.(*ListFlexFlowResponse) 369 } 370 371 close(recordChannel) 372 close(errorChannel) 373 } 374 375 func (c *ApiService) getNextListFlexFlowResponse(nextPageUrl string) (interface{}, error) { 376 if nextPageUrl == "" { 377 return nil, nil 378 } 379 resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) 380 if err != nil { 381 return nil, err 382 } 383 384 defer resp.Body.Close() 385 386 ps := &ListFlexFlowResponse{} 387 if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { 388 return nil, err 389 } 390 return ps, nil 391 } 392 393 // Optional parameters for the method 'UpdateFlexFlow' 394 type UpdateFlexFlowParams struct { 395 // A descriptive string that you create to describe the Flex Flow resource. 396 FriendlyName *string `json:"FriendlyName,omitempty"` 397 // The SID of the chat service. 398 ChatServiceSid *string `json:"ChatServiceSid,omitempty"` 399 // 400 ChannelType *string `json:"ChannelType,omitempty"` 401 // The channel contact's Identity. 402 ContactIdentity *string `json:"ContactIdentity,omitempty"` 403 // Whether the new Flex Flow is enabled. 404 Enabled *bool `json:"Enabled,omitempty"` 405 // 406 IntegrationType *string `json:"IntegrationType,omitempty"` 407 // The SID of the Studio Flow. Required when `integrationType` is `studio`. 408 IntegrationFlowSid *string `json:"Integration.FlowSid,omitempty"` 409 // The URL of the external webhook. Required when `integrationType` is `external`. 410 IntegrationUrl *string `json:"Integration.Url,omitempty"` 411 // The Workspace SID for a new Task. Required when `integrationType` is `task`. 412 IntegrationWorkspaceSid *string `json:"Integration.WorkspaceSid,omitempty"` 413 // The Workflow SID for a new Task. Required when `integrationType` is `task`. 414 IntegrationWorkflowSid *string `json:"Integration.WorkflowSid,omitempty"` 415 // The Task Channel SID (TCXXXX) or unique name (e.g., `sms`) to use for the Task that will be created. Applicable and required when `integrationType` is `task`. The default value is `default`. 416 IntegrationChannel *string `json:"Integration.Channel,omitempty"` 417 // The Task timeout in seconds for a new Task. Default is 86,400 seconds (24 hours). Optional when `integrationType` is `task`, not applicable otherwise. 418 IntegrationTimeout *int `json:"Integration.Timeout,omitempty"` 419 // The Task priority of a new Task. The default priority is 0. Optional when `integrationType` is `task`, not applicable otherwise. 420 IntegrationPriority *int `json:"Integration.Priority,omitempty"` 421 // In the context of outbound messaging, defines whether to create a Task immediately (and therefore reserve the conversation to current agent), or delay Task creation until the customer sends the first response. Set to false to create immediately, true to delay Task creation. This setting is only applicable for outbound messaging. 422 IntegrationCreationOnMessage *bool `json:"Integration.CreationOnMessage,omitempty"` 423 // When enabled, Flex will keep the chat channel active so that it may be used for subsequent interactions with a contact identity. Defaults to `false`. 424 LongLived *bool `json:"LongLived,omitempty"` 425 // When enabled, the Messaging Channel Janitor will remove active Proxy sessions if the associated Task is deleted outside of the Flex UI. Defaults to `false`. 426 JanitorEnabled *bool `json:"JanitorEnabled,omitempty"` 427 // The number of times to retry the Studio Flow or webhook in case of failure. Takes integer values from 0 to 3 with the default being 3. Optional when `integrationType` is `studio` or `external`, not applicable otherwise. 428 IntegrationRetryCount *int `json:"Integration.RetryCount,omitempty"` 429 } 430 431 func (params *UpdateFlexFlowParams) SetFriendlyName(FriendlyName string) *UpdateFlexFlowParams { 432 params.FriendlyName = &FriendlyName 433 return params 434 } 435 func (params *UpdateFlexFlowParams) SetChatServiceSid(ChatServiceSid string) *UpdateFlexFlowParams { 436 params.ChatServiceSid = &ChatServiceSid 437 return params 438 } 439 func (params *UpdateFlexFlowParams) SetChannelType(ChannelType string) *UpdateFlexFlowParams { 440 params.ChannelType = &ChannelType 441 return params 442 } 443 func (params *UpdateFlexFlowParams) SetContactIdentity(ContactIdentity string) *UpdateFlexFlowParams { 444 params.ContactIdentity = &ContactIdentity 445 return params 446 } 447 func (params *UpdateFlexFlowParams) SetEnabled(Enabled bool) *UpdateFlexFlowParams { 448 params.Enabled = &Enabled 449 return params 450 } 451 func (params *UpdateFlexFlowParams) SetIntegrationType(IntegrationType string) *UpdateFlexFlowParams { 452 params.IntegrationType = &IntegrationType 453 return params 454 } 455 func (params *UpdateFlexFlowParams) SetIntegrationFlowSid(IntegrationFlowSid string) *UpdateFlexFlowParams { 456 params.IntegrationFlowSid = &IntegrationFlowSid 457 return params 458 } 459 func (params *UpdateFlexFlowParams) SetIntegrationUrl(IntegrationUrl string) *UpdateFlexFlowParams { 460 params.IntegrationUrl = &IntegrationUrl 461 return params 462 } 463 func (params *UpdateFlexFlowParams) SetIntegrationWorkspaceSid(IntegrationWorkspaceSid string) *UpdateFlexFlowParams { 464 params.IntegrationWorkspaceSid = &IntegrationWorkspaceSid 465 return params 466 } 467 func (params *UpdateFlexFlowParams) SetIntegrationWorkflowSid(IntegrationWorkflowSid string) *UpdateFlexFlowParams { 468 params.IntegrationWorkflowSid = &IntegrationWorkflowSid 469 return params 470 } 471 func (params *UpdateFlexFlowParams) SetIntegrationChannel(IntegrationChannel string) *UpdateFlexFlowParams { 472 params.IntegrationChannel = &IntegrationChannel 473 return params 474 } 475 func (params *UpdateFlexFlowParams) SetIntegrationTimeout(IntegrationTimeout int) *UpdateFlexFlowParams { 476 params.IntegrationTimeout = &IntegrationTimeout 477 return params 478 } 479 func (params *UpdateFlexFlowParams) SetIntegrationPriority(IntegrationPriority int) *UpdateFlexFlowParams { 480 params.IntegrationPriority = &IntegrationPriority 481 return params 482 } 483 func (params *UpdateFlexFlowParams) SetIntegrationCreationOnMessage(IntegrationCreationOnMessage bool) *UpdateFlexFlowParams { 484 params.IntegrationCreationOnMessage = &IntegrationCreationOnMessage 485 return params 486 } 487 func (params *UpdateFlexFlowParams) SetLongLived(LongLived bool) *UpdateFlexFlowParams { 488 params.LongLived = &LongLived 489 return params 490 } 491 func (params *UpdateFlexFlowParams) SetJanitorEnabled(JanitorEnabled bool) *UpdateFlexFlowParams { 492 params.JanitorEnabled = &JanitorEnabled 493 return params 494 } 495 func (params *UpdateFlexFlowParams) SetIntegrationRetryCount(IntegrationRetryCount int) *UpdateFlexFlowParams { 496 params.IntegrationRetryCount = &IntegrationRetryCount 497 return params 498 } 499 500 // 501 func (c *ApiService) UpdateFlexFlow(Sid string, params *UpdateFlexFlowParams) (*FlexV1FlexFlow, error) { 502 path := "/v1/FlexFlows/{Sid}" 503 path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) 504 505 data := url.Values{} 506 headers := make(map[string]interface{}) 507 508 if params != nil && params.FriendlyName != nil { 509 data.Set("FriendlyName", *params.FriendlyName) 510 } 511 if params != nil && params.ChatServiceSid != nil { 512 data.Set("ChatServiceSid", *params.ChatServiceSid) 513 } 514 if params != nil && params.ChannelType != nil { 515 data.Set("ChannelType", *params.ChannelType) 516 } 517 if params != nil && params.ContactIdentity != nil { 518 data.Set("ContactIdentity", *params.ContactIdentity) 519 } 520 if params != nil && params.Enabled != nil { 521 data.Set("Enabled", fmt.Sprint(*params.Enabled)) 522 } 523 if params != nil && params.IntegrationType != nil { 524 data.Set("IntegrationType", *params.IntegrationType) 525 } 526 if params != nil && params.IntegrationFlowSid != nil { 527 data.Set("Integration.FlowSid", *params.IntegrationFlowSid) 528 } 529 if params != nil && params.IntegrationUrl != nil { 530 data.Set("Integration.Url", *params.IntegrationUrl) 531 } 532 if params != nil && params.IntegrationWorkspaceSid != nil { 533 data.Set("Integration.WorkspaceSid", *params.IntegrationWorkspaceSid) 534 } 535 if params != nil && params.IntegrationWorkflowSid != nil { 536 data.Set("Integration.WorkflowSid", *params.IntegrationWorkflowSid) 537 } 538 if params != nil && params.IntegrationChannel != nil { 539 data.Set("Integration.Channel", *params.IntegrationChannel) 540 } 541 if params != nil && params.IntegrationTimeout != nil { 542 data.Set("Integration.Timeout", fmt.Sprint(*params.IntegrationTimeout)) 543 } 544 if params != nil && params.IntegrationPriority != nil { 545 data.Set("Integration.Priority", fmt.Sprint(*params.IntegrationPriority)) 546 } 547 if params != nil && params.IntegrationCreationOnMessage != nil { 548 data.Set("Integration.CreationOnMessage", fmt.Sprint(*params.IntegrationCreationOnMessage)) 549 } 550 if params != nil && params.LongLived != nil { 551 data.Set("LongLived", fmt.Sprint(*params.LongLived)) 552 } 553 if params != nil && params.JanitorEnabled != nil { 554 data.Set("JanitorEnabled", fmt.Sprint(*params.JanitorEnabled)) 555 } 556 if params != nil && params.IntegrationRetryCount != nil { 557 data.Set("Integration.RetryCount", fmt.Sprint(*params.IntegrationRetryCount)) 558 } 559 560 resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) 561 if err != nil { 562 return nil, err 563 } 564 565 defer resp.Body.Close() 566 567 ps := &FlexV1FlexFlow{} 568 if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { 569 return nil, err 570 } 571 572 return ps, err 573 }