github.com/twilio/twilio-go@v1.20.1/rest/messaging/v1/tollfree_verifications.go (about) 1 /* 2 * This code was generated by 3 * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ 4 * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ 5 * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ 6 * 7 * Twilio - Messaging 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 'CreateTollfreeVerification' 27 type CreateTollfreeVerificationParams struct { 28 // The name of the business or organization using the Tollfree number. 29 BusinessName *string `json:"BusinessName,omitempty"` 30 // The website of the business or organization using the Tollfree number. 31 BusinessWebsite *string `json:"BusinessWebsite,omitempty"` 32 // The email address to receive the notification about the verification result. . 33 NotificationEmail *string `json:"NotificationEmail,omitempty"` 34 // The category of the use case for the Tollfree Number. List as many are applicable.. 35 UseCaseCategories *[]string `json:"UseCaseCategories,omitempty"` 36 // Use this to further explain how messaging is used by the business or organization. 37 UseCaseSummary *string `json:"UseCaseSummary,omitempty"` 38 // An example of message content, i.e. a sample message. 39 ProductionMessageSample *string `json:"ProductionMessageSample,omitempty"` 40 // Link to an image that shows the opt-in workflow. Multiple images allowed and must be a publicly hosted URL. 41 OptInImageUrls *[]string `json:"OptInImageUrls,omitempty"` 42 // 43 OptInType *string `json:"OptInType,omitempty"` 44 // Estimate monthly volume of messages from the Tollfree Number. 45 MessageVolume *string `json:"MessageVolume,omitempty"` 46 // The SID of the Phone Number associated with the Tollfree Verification. 47 TollfreePhoneNumberSid *string `json:"TollfreePhoneNumberSid,omitempty"` 48 // Customer's Profile Bundle BundleSid. 49 CustomerProfileSid *string `json:"CustomerProfileSid,omitempty"` 50 // The address of the business or organization using the Tollfree number. 51 BusinessStreetAddress *string `json:"BusinessStreetAddress,omitempty"` 52 // The address of the business or organization using the Tollfree number. 53 BusinessStreetAddress2 *string `json:"BusinessStreetAddress2,omitempty"` 54 // The city of the business or organization using the Tollfree number. 55 BusinessCity *string `json:"BusinessCity,omitempty"` 56 // The state/province/region of the business or organization using the Tollfree number. 57 BusinessStateProvinceRegion *string `json:"BusinessStateProvinceRegion,omitempty"` 58 // The postal code of the business or organization using the Tollfree number. 59 BusinessPostalCode *string `json:"BusinessPostalCode,omitempty"` 60 // The country of the business or organization using the Tollfree number. 61 BusinessCountry *string `json:"BusinessCountry,omitempty"` 62 // Additional information to be provided for verification. 63 AdditionalInformation *string `json:"AdditionalInformation,omitempty"` 64 // The first name of the contact for the business or organization using the Tollfree number. 65 BusinessContactFirstName *string `json:"BusinessContactFirstName,omitempty"` 66 // The last name of the contact for the business or organization using the Tollfree number. 67 BusinessContactLastName *string `json:"BusinessContactLastName,omitempty"` 68 // The email address of the contact for the business or organization using the Tollfree number. 69 BusinessContactEmail *string `json:"BusinessContactEmail,omitempty"` 70 // The E.164 formatted phone number of the contact for the business or organization using the Tollfree number. 71 BusinessContactPhone *string `json:"BusinessContactPhone,omitempty"` 72 // An optional external reference ID supplied by customer and echoed back on status retrieval. 73 ExternalReferenceId *string `json:"ExternalReferenceId,omitempty"` 74 } 75 76 func (params *CreateTollfreeVerificationParams) SetBusinessName(BusinessName string) *CreateTollfreeVerificationParams { 77 params.BusinessName = &BusinessName 78 return params 79 } 80 func (params *CreateTollfreeVerificationParams) SetBusinessWebsite(BusinessWebsite string) *CreateTollfreeVerificationParams { 81 params.BusinessWebsite = &BusinessWebsite 82 return params 83 } 84 func (params *CreateTollfreeVerificationParams) SetNotificationEmail(NotificationEmail string) *CreateTollfreeVerificationParams { 85 params.NotificationEmail = &NotificationEmail 86 return params 87 } 88 func (params *CreateTollfreeVerificationParams) SetUseCaseCategories(UseCaseCategories []string) *CreateTollfreeVerificationParams { 89 params.UseCaseCategories = &UseCaseCategories 90 return params 91 } 92 func (params *CreateTollfreeVerificationParams) SetUseCaseSummary(UseCaseSummary string) *CreateTollfreeVerificationParams { 93 params.UseCaseSummary = &UseCaseSummary 94 return params 95 } 96 func (params *CreateTollfreeVerificationParams) SetProductionMessageSample(ProductionMessageSample string) *CreateTollfreeVerificationParams { 97 params.ProductionMessageSample = &ProductionMessageSample 98 return params 99 } 100 func (params *CreateTollfreeVerificationParams) SetOptInImageUrls(OptInImageUrls []string) *CreateTollfreeVerificationParams { 101 params.OptInImageUrls = &OptInImageUrls 102 return params 103 } 104 func (params *CreateTollfreeVerificationParams) SetOptInType(OptInType string) *CreateTollfreeVerificationParams { 105 params.OptInType = &OptInType 106 return params 107 } 108 func (params *CreateTollfreeVerificationParams) SetMessageVolume(MessageVolume string) *CreateTollfreeVerificationParams { 109 params.MessageVolume = &MessageVolume 110 return params 111 } 112 func (params *CreateTollfreeVerificationParams) SetTollfreePhoneNumberSid(TollfreePhoneNumberSid string) *CreateTollfreeVerificationParams { 113 params.TollfreePhoneNumberSid = &TollfreePhoneNumberSid 114 return params 115 } 116 func (params *CreateTollfreeVerificationParams) SetCustomerProfileSid(CustomerProfileSid string) *CreateTollfreeVerificationParams { 117 params.CustomerProfileSid = &CustomerProfileSid 118 return params 119 } 120 func (params *CreateTollfreeVerificationParams) SetBusinessStreetAddress(BusinessStreetAddress string) *CreateTollfreeVerificationParams { 121 params.BusinessStreetAddress = &BusinessStreetAddress 122 return params 123 } 124 func (params *CreateTollfreeVerificationParams) SetBusinessStreetAddress2(BusinessStreetAddress2 string) *CreateTollfreeVerificationParams { 125 params.BusinessStreetAddress2 = &BusinessStreetAddress2 126 return params 127 } 128 func (params *CreateTollfreeVerificationParams) SetBusinessCity(BusinessCity string) *CreateTollfreeVerificationParams { 129 params.BusinessCity = &BusinessCity 130 return params 131 } 132 func (params *CreateTollfreeVerificationParams) SetBusinessStateProvinceRegion(BusinessStateProvinceRegion string) *CreateTollfreeVerificationParams { 133 params.BusinessStateProvinceRegion = &BusinessStateProvinceRegion 134 return params 135 } 136 func (params *CreateTollfreeVerificationParams) SetBusinessPostalCode(BusinessPostalCode string) *CreateTollfreeVerificationParams { 137 params.BusinessPostalCode = &BusinessPostalCode 138 return params 139 } 140 func (params *CreateTollfreeVerificationParams) SetBusinessCountry(BusinessCountry string) *CreateTollfreeVerificationParams { 141 params.BusinessCountry = &BusinessCountry 142 return params 143 } 144 func (params *CreateTollfreeVerificationParams) SetAdditionalInformation(AdditionalInformation string) *CreateTollfreeVerificationParams { 145 params.AdditionalInformation = &AdditionalInformation 146 return params 147 } 148 func (params *CreateTollfreeVerificationParams) SetBusinessContactFirstName(BusinessContactFirstName string) *CreateTollfreeVerificationParams { 149 params.BusinessContactFirstName = &BusinessContactFirstName 150 return params 151 } 152 func (params *CreateTollfreeVerificationParams) SetBusinessContactLastName(BusinessContactLastName string) *CreateTollfreeVerificationParams { 153 params.BusinessContactLastName = &BusinessContactLastName 154 return params 155 } 156 func (params *CreateTollfreeVerificationParams) SetBusinessContactEmail(BusinessContactEmail string) *CreateTollfreeVerificationParams { 157 params.BusinessContactEmail = &BusinessContactEmail 158 return params 159 } 160 func (params *CreateTollfreeVerificationParams) SetBusinessContactPhone(BusinessContactPhone string) *CreateTollfreeVerificationParams { 161 params.BusinessContactPhone = &BusinessContactPhone 162 return params 163 } 164 func (params *CreateTollfreeVerificationParams) SetExternalReferenceId(ExternalReferenceId string) *CreateTollfreeVerificationParams { 165 params.ExternalReferenceId = &ExternalReferenceId 166 return params 167 } 168 169 // 170 func (c *ApiService) CreateTollfreeVerification(params *CreateTollfreeVerificationParams) (*MessagingV1TollfreeVerification, error) { 171 path := "/v1/Tollfree/Verifications" 172 173 data := url.Values{} 174 headers := make(map[string]interface{}) 175 176 if params != nil && params.BusinessName != nil { 177 data.Set("BusinessName", *params.BusinessName) 178 } 179 if params != nil && params.BusinessWebsite != nil { 180 data.Set("BusinessWebsite", *params.BusinessWebsite) 181 } 182 if params != nil && params.NotificationEmail != nil { 183 data.Set("NotificationEmail", *params.NotificationEmail) 184 } 185 if params != nil && params.UseCaseCategories != nil { 186 for _, item := range *params.UseCaseCategories { 187 data.Add("UseCaseCategories", item) 188 } 189 } 190 if params != nil && params.UseCaseSummary != nil { 191 data.Set("UseCaseSummary", *params.UseCaseSummary) 192 } 193 if params != nil && params.ProductionMessageSample != nil { 194 data.Set("ProductionMessageSample", *params.ProductionMessageSample) 195 } 196 if params != nil && params.OptInImageUrls != nil { 197 for _, item := range *params.OptInImageUrls { 198 data.Add("OptInImageUrls", item) 199 } 200 } 201 if params != nil && params.OptInType != nil { 202 data.Set("OptInType", *params.OptInType) 203 } 204 if params != nil && params.MessageVolume != nil { 205 data.Set("MessageVolume", *params.MessageVolume) 206 } 207 if params != nil && params.TollfreePhoneNumberSid != nil { 208 data.Set("TollfreePhoneNumberSid", *params.TollfreePhoneNumberSid) 209 } 210 if params != nil && params.CustomerProfileSid != nil { 211 data.Set("CustomerProfileSid", *params.CustomerProfileSid) 212 } 213 if params != nil && params.BusinessStreetAddress != nil { 214 data.Set("BusinessStreetAddress", *params.BusinessStreetAddress) 215 } 216 if params != nil && params.BusinessStreetAddress2 != nil { 217 data.Set("BusinessStreetAddress2", *params.BusinessStreetAddress2) 218 } 219 if params != nil && params.BusinessCity != nil { 220 data.Set("BusinessCity", *params.BusinessCity) 221 } 222 if params != nil && params.BusinessStateProvinceRegion != nil { 223 data.Set("BusinessStateProvinceRegion", *params.BusinessStateProvinceRegion) 224 } 225 if params != nil && params.BusinessPostalCode != nil { 226 data.Set("BusinessPostalCode", *params.BusinessPostalCode) 227 } 228 if params != nil && params.BusinessCountry != nil { 229 data.Set("BusinessCountry", *params.BusinessCountry) 230 } 231 if params != nil && params.AdditionalInformation != nil { 232 data.Set("AdditionalInformation", *params.AdditionalInformation) 233 } 234 if params != nil && params.BusinessContactFirstName != nil { 235 data.Set("BusinessContactFirstName", *params.BusinessContactFirstName) 236 } 237 if params != nil && params.BusinessContactLastName != nil { 238 data.Set("BusinessContactLastName", *params.BusinessContactLastName) 239 } 240 if params != nil && params.BusinessContactEmail != nil { 241 data.Set("BusinessContactEmail", *params.BusinessContactEmail) 242 } 243 if params != nil && params.BusinessContactPhone != nil { 244 data.Set("BusinessContactPhone", *params.BusinessContactPhone) 245 } 246 if params != nil && params.ExternalReferenceId != nil { 247 data.Set("ExternalReferenceId", *params.ExternalReferenceId) 248 } 249 250 resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) 251 if err != nil { 252 return nil, err 253 } 254 255 defer resp.Body.Close() 256 257 ps := &MessagingV1TollfreeVerification{} 258 if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { 259 return nil, err 260 } 261 262 return ps, err 263 } 264 265 // 266 func (c *ApiService) DeleteTollfreeVerification(Sid string) error { 267 path := "/v1/Tollfree/Verifications/{Sid}" 268 path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) 269 270 data := url.Values{} 271 headers := make(map[string]interface{}) 272 273 resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) 274 if err != nil { 275 return err 276 } 277 278 defer resp.Body.Close() 279 280 return nil 281 } 282 283 // 284 func (c *ApiService) FetchTollfreeVerification(Sid string) (*MessagingV1TollfreeVerification, error) { 285 path := "/v1/Tollfree/Verifications/{Sid}" 286 path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) 287 288 data := url.Values{} 289 headers := make(map[string]interface{}) 290 291 resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) 292 if err != nil { 293 return nil, err 294 } 295 296 defer resp.Body.Close() 297 298 ps := &MessagingV1TollfreeVerification{} 299 if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { 300 return nil, err 301 } 302 303 return ps, err 304 } 305 306 // Optional parameters for the method 'ListTollfreeVerification' 307 type ListTollfreeVerificationParams struct { 308 // The SID of the Phone Number associated with the Tollfree Verification. 309 TollfreePhoneNumberSid *string `json:"TollfreePhoneNumberSid,omitempty"` 310 // The compliance status of the Tollfree Verification record. 311 Status *string `json:"Status,omitempty"` 312 // How many resources to return in each list page. The default is 50, and the maximum is 1000. 313 PageSize *int `json:"PageSize,omitempty"` 314 // Max number of records to return. 315 Limit *int `json:"limit,omitempty"` 316 } 317 318 func (params *ListTollfreeVerificationParams) SetTollfreePhoneNumberSid(TollfreePhoneNumberSid string) *ListTollfreeVerificationParams { 319 params.TollfreePhoneNumberSid = &TollfreePhoneNumberSid 320 return params 321 } 322 func (params *ListTollfreeVerificationParams) SetStatus(Status string) *ListTollfreeVerificationParams { 323 params.Status = &Status 324 return params 325 } 326 func (params *ListTollfreeVerificationParams) SetPageSize(PageSize int) *ListTollfreeVerificationParams { 327 params.PageSize = &PageSize 328 return params 329 } 330 func (params *ListTollfreeVerificationParams) SetLimit(Limit int) *ListTollfreeVerificationParams { 331 params.Limit = &Limit 332 return params 333 } 334 335 // Retrieve a single page of TollfreeVerification records from the API. Request is executed immediately. 336 func (c *ApiService) PageTollfreeVerification(params *ListTollfreeVerificationParams, pageToken, pageNumber string) (*ListTollfreeVerificationResponse, error) { 337 path := "/v1/Tollfree/Verifications" 338 339 data := url.Values{} 340 headers := make(map[string]interface{}) 341 342 if params != nil && params.TollfreePhoneNumberSid != nil { 343 data.Set("TollfreePhoneNumberSid", *params.TollfreePhoneNumberSid) 344 } 345 if params != nil && params.Status != nil { 346 data.Set("Status", *params.Status) 347 } 348 if params != nil && params.PageSize != nil { 349 data.Set("PageSize", fmt.Sprint(*params.PageSize)) 350 } 351 352 if pageToken != "" { 353 data.Set("PageToken", pageToken) 354 } 355 if pageNumber != "" { 356 data.Set("Page", pageNumber) 357 } 358 359 resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) 360 if err != nil { 361 return nil, err 362 } 363 364 defer resp.Body.Close() 365 366 ps := &ListTollfreeVerificationResponse{} 367 if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { 368 return nil, err 369 } 370 371 return ps, err 372 } 373 374 // Lists TollfreeVerification records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. 375 func (c *ApiService) ListTollfreeVerification(params *ListTollfreeVerificationParams) ([]MessagingV1TollfreeVerification, error) { 376 response, errors := c.StreamTollfreeVerification(params) 377 378 records := make([]MessagingV1TollfreeVerification, 0) 379 for record := range response { 380 records = append(records, record) 381 } 382 383 if err := <-errors; err != nil { 384 return nil, err 385 } 386 387 return records, nil 388 } 389 390 // Streams TollfreeVerification records from the API as a channel stream. This operation lazily loads records as efficiently as possible until the limit is reached. 391 func (c *ApiService) StreamTollfreeVerification(params *ListTollfreeVerificationParams) (chan MessagingV1TollfreeVerification, chan error) { 392 if params == nil { 393 params = &ListTollfreeVerificationParams{} 394 } 395 params.SetPageSize(client.ReadLimits(params.PageSize, params.Limit)) 396 397 recordChannel := make(chan MessagingV1TollfreeVerification, 1) 398 errorChannel := make(chan error, 1) 399 400 response, err := c.PageTollfreeVerification(params, "", "") 401 if err != nil { 402 errorChannel <- err 403 close(recordChannel) 404 close(errorChannel) 405 } else { 406 go c.streamTollfreeVerification(response, params, recordChannel, errorChannel) 407 } 408 409 return recordChannel, errorChannel 410 } 411 412 func (c *ApiService) streamTollfreeVerification(response *ListTollfreeVerificationResponse, params *ListTollfreeVerificationParams, recordChannel chan MessagingV1TollfreeVerification, errorChannel chan error) { 413 curRecord := 1 414 415 for response != nil { 416 responseRecords := response.Verifications 417 for item := range responseRecords { 418 recordChannel <- responseRecords[item] 419 curRecord += 1 420 if params.Limit != nil && *params.Limit < curRecord { 421 close(recordChannel) 422 close(errorChannel) 423 return 424 } 425 } 426 427 record, err := client.GetNext(c.baseURL, response, c.getNextListTollfreeVerificationResponse) 428 if err != nil { 429 errorChannel <- err 430 break 431 } else if record == nil { 432 break 433 } 434 435 response = record.(*ListTollfreeVerificationResponse) 436 } 437 438 close(recordChannel) 439 close(errorChannel) 440 } 441 442 func (c *ApiService) getNextListTollfreeVerificationResponse(nextPageUrl string) (interface{}, error) { 443 if nextPageUrl == "" { 444 return nil, nil 445 } 446 resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) 447 if err != nil { 448 return nil, err 449 } 450 451 defer resp.Body.Close() 452 453 ps := &ListTollfreeVerificationResponse{} 454 if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { 455 return nil, err 456 } 457 return ps, nil 458 } 459 460 // Optional parameters for the method 'UpdateTollfreeVerification' 461 type UpdateTollfreeVerificationParams struct { 462 // The name of the business or organization using the Tollfree number. 463 BusinessName *string `json:"BusinessName,omitempty"` 464 // The website of the business or organization using the Tollfree number. 465 BusinessWebsite *string `json:"BusinessWebsite,omitempty"` 466 // The email address to receive the notification about the verification result. . 467 NotificationEmail *string `json:"NotificationEmail,omitempty"` 468 // The category of the use case for the Tollfree Number. List as many are applicable.. 469 UseCaseCategories *[]string `json:"UseCaseCategories,omitempty"` 470 // Use this to further explain how messaging is used by the business or organization. 471 UseCaseSummary *string `json:"UseCaseSummary,omitempty"` 472 // An example of message content, i.e. a sample message. 473 ProductionMessageSample *string `json:"ProductionMessageSample,omitempty"` 474 // Link to an image that shows the opt-in workflow. Multiple images allowed and must be a publicly hosted URL. 475 OptInImageUrls *[]string `json:"OptInImageUrls,omitempty"` 476 // 477 OptInType *string `json:"OptInType,omitempty"` 478 // Estimate monthly volume of messages from the Tollfree Number. 479 MessageVolume *string `json:"MessageVolume,omitempty"` 480 // The address of the business or organization using the Tollfree number. 481 BusinessStreetAddress *string `json:"BusinessStreetAddress,omitempty"` 482 // The address of the business or organization using the Tollfree number. 483 BusinessStreetAddress2 *string `json:"BusinessStreetAddress2,omitempty"` 484 // The city of the business or organization using the Tollfree number. 485 BusinessCity *string `json:"BusinessCity,omitempty"` 486 // The state/province/region of the business or organization using the Tollfree number. 487 BusinessStateProvinceRegion *string `json:"BusinessStateProvinceRegion,omitempty"` 488 // The postal code of the business or organization using the Tollfree number. 489 BusinessPostalCode *string `json:"BusinessPostalCode,omitempty"` 490 // The country of the business or organization using the Tollfree number. 491 BusinessCountry *string `json:"BusinessCountry,omitempty"` 492 // Additional information to be provided for verification. 493 AdditionalInformation *string `json:"AdditionalInformation,omitempty"` 494 // The first name of the contact for the business or organization using the Tollfree number. 495 BusinessContactFirstName *string `json:"BusinessContactFirstName,omitempty"` 496 // The last name of the contact for the business or organization using the Tollfree number. 497 BusinessContactLastName *string `json:"BusinessContactLastName,omitempty"` 498 // The email address of the contact for the business or organization using the Tollfree number. 499 BusinessContactEmail *string `json:"BusinessContactEmail,omitempty"` 500 // The E.164 formatted phone number of the contact for the business or organization using the Tollfree number. 501 BusinessContactPhone *string `json:"BusinessContactPhone,omitempty"` 502 // Describe why the verification is being edited. If the verification was rejected because of a technical issue, such as the website being down, and the issue has been resolved this parameter should be set to something similar to 'Website fixed'. 503 EditReason *string `json:"EditReason,omitempty"` 504 } 505 506 func (params *UpdateTollfreeVerificationParams) SetBusinessName(BusinessName string) *UpdateTollfreeVerificationParams { 507 params.BusinessName = &BusinessName 508 return params 509 } 510 func (params *UpdateTollfreeVerificationParams) SetBusinessWebsite(BusinessWebsite string) *UpdateTollfreeVerificationParams { 511 params.BusinessWebsite = &BusinessWebsite 512 return params 513 } 514 func (params *UpdateTollfreeVerificationParams) SetNotificationEmail(NotificationEmail string) *UpdateTollfreeVerificationParams { 515 params.NotificationEmail = &NotificationEmail 516 return params 517 } 518 func (params *UpdateTollfreeVerificationParams) SetUseCaseCategories(UseCaseCategories []string) *UpdateTollfreeVerificationParams { 519 params.UseCaseCategories = &UseCaseCategories 520 return params 521 } 522 func (params *UpdateTollfreeVerificationParams) SetUseCaseSummary(UseCaseSummary string) *UpdateTollfreeVerificationParams { 523 params.UseCaseSummary = &UseCaseSummary 524 return params 525 } 526 func (params *UpdateTollfreeVerificationParams) SetProductionMessageSample(ProductionMessageSample string) *UpdateTollfreeVerificationParams { 527 params.ProductionMessageSample = &ProductionMessageSample 528 return params 529 } 530 func (params *UpdateTollfreeVerificationParams) SetOptInImageUrls(OptInImageUrls []string) *UpdateTollfreeVerificationParams { 531 params.OptInImageUrls = &OptInImageUrls 532 return params 533 } 534 func (params *UpdateTollfreeVerificationParams) SetOptInType(OptInType string) *UpdateTollfreeVerificationParams { 535 params.OptInType = &OptInType 536 return params 537 } 538 func (params *UpdateTollfreeVerificationParams) SetMessageVolume(MessageVolume string) *UpdateTollfreeVerificationParams { 539 params.MessageVolume = &MessageVolume 540 return params 541 } 542 func (params *UpdateTollfreeVerificationParams) SetBusinessStreetAddress(BusinessStreetAddress string) *UpdateTollfreeVerificationParams { 543 params.BusinessStreetAddress = &BusinessStreetAddress 544 return params 545 } 546 func (params *UpdateTollfreeVerificationParams) SetBusinessStreetAddress2(BusinessStreetAddress2 string) *UpdateTollfreeVerificationParams { 547 params.BusinessStreetAddress2 = &BusinessStreetAddress2 548 return params 549 } 550 func (params *UpdateTollfreeVerificationParams) SetBusinessCity(BusinessCity string) *UpdateTollfreeVerificationParams { 551 params.BusinessCity = &BusinessCity 552 return params 553 } 554 func (params *UpdateTollfreeVerificationParams) SetBusinessStateProvinceRegion(BusinessStateProvinceRegion string) *UpdateTollfreeVerificationParams { 555 params.BusinessStateProvinceRegion = &BusinessStateProvinceRegion 556 return params 557 } 558 func (params *UpdateTollfreeVerificationParams) SetBusinessPostalCode(BusinessPostalCode string) *UpdateTollfreeVerificationParams { 559 params.BusinessPostalCode = &BusinessPostalCode 560 return params 561 } 562 func (params *UpdateTollfreeVerificationParams) SetBusinessCountry(BusinessCountry string) *UpdateTollfreeVerificationParams { 563 params.BusinessCountry = &BusinessCountry 564 return params 565 } 566 func (params *UpdateTollfreeVerificationParams) SetAdditionalInformation(AdditionalInformation string) *UpdateTollfreeVerificationParams { 567 params.AdditionalInformation = &AdditionalInformation 568 return params 569 } 570 func (params *UpdateTollfreeVerificationParams) SetBusinessContactFirstName(BusinessContactFirstName string) *UpdateTollfreeVerificationParams { 571 params.BusinessContactFirstName = &BusinessContactFirstName 572 return params 573 } 574 func (params *UpdateTollfreeVerificationParams) SetBusinessContactLastName(BusinessContactLastName string) *UpdateTollfreeVerificationParams { 575 params.BusinessContactLastName = &BusinessContactLastName 576 return params 577 } 578 func (params *UpdateTollfreeVerificationParams) SetBusinessContactEmail(BusinessContactEmail string) *UpdateTollfreeVerificationParams { 579 params.BusinessContactEmail = &BusinessContactEmail 580 return params 581 } 582 func (params *UpdateTollfreeVerificationParams) SetBusinessContactPhone(BusinessContactPhone string) *UpdateTollfreeVerificationParams { 583 params.BusinessContactPhone = &BusinessContactPhone 584 return params 585 } 586 func (params *UpdateTollfreeVerificationParams) SetEditReason(EditReason string) *UpdateTollfreeVerificationParams { 587 params.EditReason = &EditReason 588 return params 589 } 590 591 // 592 func (c *ApiService) UpdateTollfreeVerification(Sid string, params *UpdateTollfreeVerificationParams) (*MessagingV1TollfreeVerification, error) { 593 path := "/v1/Tollfree/Verifications/{Sid}" 594 path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) 595 596 data := url.Values{} 597 headers := make(map[string]interface{}) 598 599 if params != nil && params.BusinessName != nil { 600 data.Set("BusinessName", *params.BusinessName) 601 } 602 if params != nil && params.BusinessWebsite != nil { 603 data.Set("BusinessWebsite", *params.BusinessWebsite) 604 } 605 if params != nil && params.NotificationEmail != nil { 606 data.Set("NotificationEmail", *params.NotificationEmail) 607 } 608 if params != nil && params.UseCaseCategories != nil { 609 for _, item := range *params.UseCaseCategories { 610 data.Add("UseCaseCategories", item) 611 } 612 } 613 if params != nil && params.UseCaseSummary != nil { 614 data.Set("UseCaseSummary", *params.UseCaseSummary) 615 } 616 if params != nil && params.ProductionMessageSample != nil { 617 data.Set("ProductionMessageSample", *params.ProductionMessageSample) 618 } 619 if params != nil && params.OptInImageUrls != nil { 620 for _, item := range *params.OptInImageUrls { 621 data.Add("OptInImageUrls", item) 622 } 623 } 624 if params != nil && params.OptInType != nil { 625 data.Set("OptInType", *params.OptInType) 626 } 627 if params != nil && params.MessageVolume != nil { 628 data.Set("MessageVolume", *params.MessageVolume) 629 } 630 if params != nil && params.BusinessStreetAddress != nil { 631 data.Set("BusinessStreetAddress", *params.BusinessStreetAddress) 632 } 633 if params != nil && params.BusinessStreetAddress2 != nil { 634 data.Set("BusinessStreetAddress2", *params.BusinessStreetAddress2) 635 } 636 if params != nil && params.BusinessCity != nil { 637 data.Set("BusinessCity", *params.BusinessCity) 638 } 639 if params != nil && params.BusinessStateProvinceRegion != nil { 640 data.Set("BusinessStateProvinceRegion", *params.BusinessStateProvinceRegion) 641 } 642 if params != nil && params.BusinessPostalCode != nil { 643 data.Set("BusinessPostalCode", *params.BusinessPostalCode) 644 } 645 if params != nil && params.BusinessCountry != nil { 646 data.Set("BusinessCountry", *params.BusinessCountry) 647 } 648 if params != nil && params.AdditionalInformation != nil { 649 data.Set("AdditionalInformation", *params.AdditionalInformation) 650 } 651 if params != nil && params.BusinessContactFirstName != nil { 652 data.Set("BusinessContactFirstName", *params.BusinessContactFirstName) 653 } 654 if params != nil && params.BusinessContactLastName != nil { 655 data.Set("BusinessContactLastName", *params.BusinessContactLastName) 656 } 657 if params != nil && params.BusinessContactEmail != nil { 658 data.Set("BusinessContactEmail", *params.BusinessContactEmail) 659 } 660 if params != nil && params.BusinessContactPhone != nil { 661 data.Set("BusinessContactPhone", *params.BusinessContactPhone) 662 } 663 if params != nil && params.EditReason != nil { 664 data.Set("EditReason", *params.EditReason) 665 } 666 667 resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) 668 if err != nil { 669 return nil, err 670 } 671 672 defer resp.Body.Close() 673 674 ps := &MessagingV1TollfreeVerification{} 675 if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { 676 return nil, err 677 } 678 679 return ps, err 680 }